//
//  DispatchQueue+.swift
//  HoneyChat
//
//  Created by hccc on 2023/4/28.
//

import Foundation

public extension DispatchQueue {
    private static var _onceKey = [String]()
    static func once(key: String, block: () -> Void) {
        objc_sync_enter(self)
        defer {
            objc_sync_exit(self)
        }
        guard !_onceKey.contains(key) else { return }
        _onceKey.append(key)
        block()
    }
}
